<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../../js/vue.js"></script>
</head>

<body>
    <div id="root">
        <h2>当前n的值是：{{n}}</h2>
        <button @click="n++">点我n++</button>
        <!-- v-show的条件渲染 -->
        <!-- <h1 v-show="true">欢迎来到{{name}}</h1> -->

        <!-- v-if的条件渲染 -->
        <!-- <h1 v-if="false">欢迎来到{{name}}</h1> -->

        <!-- <div v-show="n===1">周露</div>
        <div v-show="n===2">李婉茹</div>
        <div v-show="n===3">迪丽热巴</div> -->

        <!-- 
        <div v-if="n===1">周露</div>
        <div v-else-if="n===2">李婉茹</div>
        <div v-else-if="n===3">迪丽热巴</div>
        <div v-else>王馨雪</div> -->

        <!-- v-if和template的结合使用 -->
        <template v-if="n===1">
            <h2>迪丽热巴</h2>
            <h2>古力娜扎</h2>
            <h2>达拉崩吧</h2>
        </template>
    </div>
    <script>
        Vue.config.productionTip = false //取消生产提示

        const vm = new Vue({
            el: '#root',
            data() {
                return {
                    name: '尚硅谷',
                    n: 0
                }
            }
        })
    </script>
</body>

</html>